package com.js.demo04;

import javafx.application.Application;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.stage.Stage;

public class Demo extends Application
{
//    第3课初步认识stage窗口
    @Override
    public void start(Stage stage) throws Exception {
        stage.setX(100);

        stage.setY(100);
        stage.setWidth(500);
        stage.setHeight(500);
        stage.setTitle("hello");

        stage.xProperty().addListener(new ChangeListener<Number>() {
            @Override
            public void changed(ObservableValue<? extends Number> observableValue, Number number, Number t1) {
                System.out.println("X: " + t1.intValue());
            }
        });
        stage.show();
    }

    @Override
    public void init() throws Exception {
        super.init();
        System.out.println("init");
    }

    @Override
    public void stop() throws Exception {
        super.stop();
        System.out.println("stop");
    }
}
